import java.util.Scanner;

/**
 * 2. 相乘
 * https://www.lanqiao.cn/problems/1444/learning/?page=1&first_category_id=1&second_category_id=3&tag_relation=intersection&tags=%E7%9C%81%E8%B5%9B,2021
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        long x = 2021;
        for(long i = 1;i <= 1000000007;i++) {
            long cnt = (x * i) % 1000000007;
            if(cnt == 999999999) {
                System.out.println(i);
                return;
            }
        }
        System.out.println(0);
        scan.close();
    }
}
